package com.markerhub.modules.admin;

import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.markerhub.common.lang.Result;
import com.markerhub.entity.AppBlueLabel;
import com.markerhub.entity.AppUserFeedback;
import com.markerhub.modules.common.BaseController;
import com.markerhub.service.AppBlueLabelService;
import com.markerhub.service.AppUserFeedbackService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/admin")
public class AdminUserFbontroller extends BaseController {

    @Resource
    AppUserFeedbackService appBlueLabelService;


    @GetMapping("/user/getFeedback")
    public Result list(AppUserFeedback appOrder) {
        Object pageAdmin = appBlueLabelService.pageAdmin(getPage(), appOrder);
        Page<AppBlueLabel> data= (Page<AppBlueLabel>) pageAdmin;
        return Result.success(MapUtil.builder()
                .put("pageData", data)
                .build()
        );
    }


    @PostMapping("/feedback/delete")
    public Result getUserSave(@RequestBody String[] ids) {
        List<String> userIds=new ArrayList<>();
        for (String string:ids){
            userIds.add(string);
        }
        int code = appBlueLabelService.delUserId(userIds);
        if (code > 0) {
            return Result.success("成功"
            );
        } else {
            return Result.fail("失败"
            );
        }
    }









}



